-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multiple DB schema support for bal persist proposal #1328
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM, I have one concern though. The schema is used to group the tables or the part of the database. Usually most of the programs are dealing with just one schema. Interacting with multiple schema is a rare case. Can we provide an alternative to globally assign a schema for all the tables being used in persist module? |
@gimantha Thanks for the feedback. Shall we move this discussion to #1327, please? |
Purpose
Many database providers allow you to organize database tables into named groups. You can use this to make the logical structure of the data model easier to understand or to avoid naming collisions between tables. These groups are known as schemas in PostgreSQL, CockroachDB, and SQL Server.
This proposal introduces support for connecting to tables in multiple database schemas in
bal persist
. Right now,bal persist
only supports connecting to tables in the default schema of the database. However, in real-world scenarios, tables are often distributed across multiple schemas in the database. When working with such existing databases, it is essential to provide a way to explicitly represent the schema of the table in the model file.Goals
bal persist
API.Approach
The current
bal persist
model supports the following annotations to map the model to a different table name in the database. For example, the following model will be mapped to thepatients
table in the database.This proposal introduces a new annotation to map the model to a different schema in the database. For example, the following model will be mapped to the
patients
table in thehealthcare
schema in the database.Related issues: #1327